package com.lagou.homework3_1;

import org.apache.hadoop.io.LongWritable;
import org.apache.hadoop.io.NullWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Mapper;

import java.io.IOException;

/**
 * Mapper类
 */
public class SortMapper extends Mapper<LongWritable, Text, Number, NullWritable> {
    /**
     * 重写map()方法，实现 map逻辑
     * @param key
     * @param value
     * @param context
     * @throws IOException
     * @throws InterruptedException
     */
    @Override
    protected void map(LongWritable key, Text value, Context context) throws IOException, InterruptedException {

        Number num = new Number(Integer.parseInt(value.toString()));
        context.write(num, NullWritable.get());
    }
}
